package com.wxjfkg.workflow.impl;

import org.activiti.engine.delegate.DelegateExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fivestar.base.vo.Constants;
import com.fivestar.credit.service.CreditApplyInfoService;
import com.fivestar.credit.service.vo.CreditChangeApplyDto;
import com.wxjfkg.workflow.BeforeEndTaskService;

@Service("creditChangeFailService")
public class CreditChangeFailService implements BeforeEndTaskService {
	
	private Logger logger = LoggerFactory.getLogger(CreditChangeFailService.class);
	
	@Autowired
	private CreditApplyInfoService creditLimitService;
	
	@Override
	public void execute(DelegateExecution execution) throws Exception {
		String bussnessKey  = execution.getProcessBusinessKey();
		logger.info("CreditChangeFailService,{}",bussnessKey);
		
		CreditChangeApplyDto failApply = new CreditChangeApplyDto();
		failApply.setChangeApplyId(bussnessKey);
		failApply.setAppStat(Constants.CreditChangeStatus.two);//申请拒绝
		creditLimitService.updateCreditChangeApplyStatus(failApply);
		
	}

}
